package com.lb.aicodebackend.service;

import com.lb.aicodebackend.dto.UserQueryRequest;
import com.lb.aicodebackend.model.vo.LoginUserVO;
import com.lb.aicodebackend.model.vo.UserVO;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.lb.aicodebackend.model.entity.User;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

/**
 * 用户 服务层。
 *
 * @author <a>libo</a>
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @param checkPassword 确认密码
     * @return 注册成功返回用户id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户密码加密
     * @param userPassword
     * @return 加密后的密码
     */
    String getEncryptPassword(String userPassword);


    LoginUserVO getLoginUserVO(User user);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);


    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);  //更新seesion要使用HttpServletRequest request

    Boolean userLogout(HttpServletRequest request);


    UserVO getUserVO(User user);

    List<UserVO> getUserVOList(List<User> userList);

    QueryWrapper getQueryWrapper(UserQueryRequest userQueryRequest);  //根据用户账号查询QueryWrapper，用于查询用户是否存在

}
